package com.xayy.health.mgt.controller;

import cn.kawins.base.result.ResultBody;
import com.xayy.health.core.utils.JsonResult;
import com.xayy.health.mgt.model.FaultModManage;
import com.xayy.health.mgt.model.faultmodmanage.pojo.dto.FaultModManageDTO;
import com.xayy.health.mgt.model.faultmodmanage.pojo.vo.FaultModManageVO;
import com.xayy.health.mgt.service.FaultModManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
*  controller
*
* @ClassName: FaultModManageController
* @Description: 控制层访问接口
* @author liuyuan
* @date 2025-06-05
*/
@RestController
@RequestMapping("/faultModManage")
@Api(tags={"故障模型接口管理"})
public class FaultModManageController  {
    @Autowired
    private FaultModManageService faultModManageService;

    public  FaultModManageService getService() {
        return faultModManageService;
    }
    public FaultModManage getEntity() {
        return new FaultModManage();
    }
    public FaultModManageDTO getDTO() {
        return new FaultModManageDTO();
    }

    @ApiOperation(value = "列表分页")
    @PostMapping("PageList")
    public ResultBody taskPageList(@RequestBody FaultModManageDTO faultModManageDTO) {
        return ResultBody.success(faultModManageService.pageList(faultModManageDTO));
    }


    @PostMapping({"/addnew"})
    @ApiOperation(value = "新增算法")
    public ResultBody addnew(FaultModManageVO vo, MultipartFile algorithmFile){
        return getService().saveFaultMod(vo,algorithmFile).body();
    }

}
